package com.qianfeng.openapi.zuul.feign;

import com.qianfeng.openapi.zuul.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/31
 * @Time: 下午3:36
 */
@FeignClient(serviceId = "openapi-cache")
public interface CacheServiceClient  {
    //@RequestMapping(value = "/set",method = RequestMethod.GET)
    @GetMapping(value = "/cache/set")
    public void  set(@RequestParam(name = "key") String key,
                     @RequestParam(name = "value") String value);

    @GetMapping("/cache/get")
    public String  get(@RequestParam(name = "key")String key);

    @DeleteMapping("/cache/delKey")
    public boolean  delKey(@RequestParam(name = "key") String key);

    @GetMapping("/cache/hgetAll")
    public Map hgetall(@RequestParam(name = "key") String key) ;

    @PostMapping("/cache/hmset")
    public R hmset(@RequestParam(name = "key")String key, @RequestBody Map<String, Object> map);

    @GetMapping("/cache/getIncreId")
    public long getAutoIncreId(@RequestParam(name = "key") String key);


    @GetMapping(value = "/cache/expire")
    public boolean  expire( @RequestParam(name = "key") String key,
                          @RequestParam(name = "second") int second);

}
